/**
 * @Title: institution_list_service.js
 * @Description: 费用service
 * Copyright: Copyright (c) 2014 
 * Company:中国平安
 *
 * @Project HIMS-FWA
 * @author ex-chenyonghong001
 * @date 2014年10月17日 上午15:02:31
 * @version V1.0
 */
;
(function(){
	'use strict';
	
	var app = angular.module('fwa.services');
	app.service('institutionDetailService',['$http','BaseURL', function($http, baseUrl){
	var debug = false;

        /**
         * 机构列表--查询机构列表信息
         * @param jsonObj
         * @param callback
         */
		this.query = function(jsonObj,callback){
			if(debug){
				return $http({
					url:baseUrl + 'mock/hcpms/getProviderDetail.json',
					method:'GET',
					params:jsonObj
				});
			}else{
				return $http({
					url:baseUrl + '/hcpms/provider/queryDetail.do',
					method:'GET',
					params:jsonObj
				});
			}
		
		};
		
		this.getProviderCode = function(jsonObj,callback){
			return $http({
				url:baseUrl + '/hcpms/provider/getProviderCode.do',
				method:'GET'
			});
		}
		

		/**
		 * 联系人列表
		 * @param jsonObj
		 * @param callback
		 */
		this.queryContactList = function(jsonObj,callback){
				return $http({
					url:baseUrl + '/hcp/hcp/contact/list.do',
					method:'GET',
					params:jsonObj
				});
		
		};
		
		/**
		 * 机构列表--更新机构列表信息
		 * @param jsonObj
		 * @param callback
		 */
		this.updateProvider = function(jsonObj,callback){
			alert(9999);
			
//			return $http({
//				url:baseUrl + '/hcpms/provider/save.do',
//				method:'POST',
//				params:jsonObj
//			});
			var data ="";
      	  		$http.post(baseUrl + '/hcpms/provider/save.do',jsonObj).success(function(data) {
				data = data;
			  })
			  return data;
		};
		
//        /**
//         * 机构详情--新增机构详情
//         * @param jsonObj
//         * @param callback
//         */
        this.createProvider = function(jsonObj,callback){
        	var data ="";
        	  $http.post(baseUrl + '/hcpms/provider/save.do',jsonObj).success(function(data) {
				data = data;
			  })
			  return data;
        };
//
//        /**
//         * 机构列表--删除机构信息
//         * @param jsonObj {id:'0333,0111'}
//         * @param callback
//         */
//        this.deleteInstitutionList = function(jsonObj,callback){
//            baseService.remove(moduleRoot+"/delete",jsonObj,callback);
//        };
	
		this.getFeeHappenAnalysis = function(year, startMonth,endMonth) {
			return $http({
				url:getUrl('getFeeHappenAnalysis'),
				method:'GET',
				params:{
					year:year,
					startMonth:startMonth,
					endMonth:endMonth
				}
			});
		}
	}]);
	
})();